﻿using System.Windows;
using EduAssess.Services.Interfaces;
using Microsoft.Win32;

namespace EduAssess.Services;

public class DialogService: IDialogService
{
    public bool OpenFileDialog(out string filename)
    {
        var openFileDialog = new OpenFileDialog();

        filename = "";

        if (openFileDialog.ShowDialog() is not true) return false;
        filename = openFileDialog.FileName;
        return true;

    }

    public bool SaveFileDialog(out string filename)
    {
        var saveFileDialog = new SaveFileDialog
        {
            DefaultExt = ".json",
            FileName = "test"
        };

        filename = "";

        if (saveFileDialog.ShowDialog() is not true) return false;
        filename = saveFileDialog.FileName;
        return true;

    }

    public void ShowMessage(string message)
    {
        MessageBox.Show(message);
    }
}